home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
unarced
/
utilities
/
shells
/
sksh
/
scr_source
/
pushd.s
< prev
next >
Wrap
Text File
|
1995-03-17
|
865b
|
25 lines
#!c:sksh
#*************************************************************************
# The following functions implement directory push and pop operations.
# The first, pushd, accepts one argument. It cd's to that directory, but
# pushes the current working directory onto a stack, first, so that it
# can later be retrieved with a popd.
#*************************************************************************
if [ "$#" -ne '1' -o "$1" = '-?' ]
then
echo 'Usage:' $(basename $0) 'new_dir'
echo ' (pushes new directory onto directory stack)'
return 1
fi
# --- the argument must be a directory we can "cd" to ---------------------
cd "$1" >nil: || echo "$0: Can't cd to $1" && return 1
# --- save off the old working directory in the DIRSTACK ------------------
DIRSTACK="$OLDPWD,$DIRSTACK"
export -l DIRSTACK